package com.ymatou.app.seller.testcase;

import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.app.seller.parameter.AddActivity_V1Bean;
import com.ymatou.app.seller.service.AddActivity_V1Call;

import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;

import com.ymttest.business.service.AuthCallService;
import com.ymttest.utils.YMTDateUtil;


/**
 * 发布直播活动
 */
@TestSuite
public class Tc_AddActivity_V1 {
	private static AddActivity_V1Bean addActivityBean;
	private static AddActivity_V1Call addActivityCall;
	
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("发布直播活动");
	}
	
	@Before
	public void caseUp() {
		addActivityBean = new AddActivity_V1Bean();
		addActivityCall = new AddActivity_V1Call();
	}
	
	@AfterClass
	public static void tearDown() {
		Logger.generateResult(addActivityCall.getOpurl());
	}
	
	@After
	public void caseDown() {
		Logger.end();
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_createActivity_001() {
		Logger.start(true,"创建直播活动成功");
		try {
			
			Map m=AuthCallService.authLogin("ukseller", "aabbcc");	
			String AccessToken = (String) m.get("AccessToken");
			int UserId = 20565820;
			// 设置参数
			addActivityBean.setAccessToken(AccessToken);
			addActivityBean.setUserId(20565820);
			addActivityBean.setSellerName("ukseller");
			addActivityBean.setPosition("中国上海市闸北区大宁路街道永和路187号");
			addActivityBean.setBrands(" ['CK', 'LV']");
			addActivityBean.setActivityName("这是一个长久有效的已开始直播-吴凤自动化直播");
			addActivityBean.setPicUrl("http://pc1.img.ymatou.com/G01/M00/09/B1/rBBlD1aWDK6AcJeTAAAIWScWAic788_c.jpg");
			addActivityBean.setActivityContent("自动化测试TEST直播活动ActivityContent-吴凤");
			addActivityBean.setStartTime(YMTDateUtil.getBeforeOrNextSecond(3));
			//Logger.debug("ststime:"+DateUtil.getSysTime());
			addActivityBean.setEndTime(YMTDateUtil.getBeforeOrNextHour(5));
			addActivityBean.setMarketId("1153");
			addActivityBean.setCategoryId("10");
			addActivityBean.setCountryId("2");
			addActivityBean.setIsReplay(0);
			addActivityBean.setDelType(0);		
			// 发送数据
			addActivityCall.setData(addActivityBean);
			addActivityCall.callService();
			Logger.comment("addActivitycall send:" + addActivityCall.getEntityString());
			Logger.comment("addActivitycall response:" + addActivityCall.getReturnData());
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}


}

